import 'package:custompaint/bean/OutputPoint.dart';
import 'package:get/get.dart';

class CurveLineBean {
  final RxDouble startX;
  final RxDouble endX;
  final RxDouble startY;
  final RxDouble endY;

  CurveLineBean(
      {required this.startX,
      required this.endX,
      required this.startY,
      required this.endY});
  Map<String, dynamic> toJson() {
    return {
      "startX": startX.value,
      "endX": endX.value,
      "startY": startY.value,
      "endY": endY.value,
    };
  }

  static CurveLineBean fromJson(e) {
    return CurveLineBean(
        startX: (double.tryParse("${e['startX']}") ?? 0).obs,
        endX: (double.tryParse("${e['endX']}") ?? 0).obs,
        startY: (double.tryParse("${e['startY']}") ?? 0).obs,
        endY: (double.tryParse("${e['endY']}") ?? 0).obs);
  }

  OutputPoint toOutput() {
    return OutputPoint(
        startX: startX.value,
        endX: endX.value,
        startY: startY.value,
        endY: endY.value);
  }
}
